<input id="${name}_upload_id" name="${name}" type="hidden" class="layui-input"/>
<div style="float: left;">
    <button type="button" class="layui-btn layui-btn-sm" id="${name}_btn"><i class="layui-icon"></i>选择文件</button>
</div>
<div style="float: left;">
    <span class="layui-inline layui-upload-choose" style="padding: 4px 10px;" id="${name}_tips"></span>
</div>

<script>
    layui.use('upload',function () {
        var upload = layui.upload;
        var $ = layui.jquery;
        var uploadId = "#${name}_upload_id";
        var btnId = "#${name}_btn";
        var tipsId = "#${name}_tips";

        //上传文件
        upload.render({
            elem: btnId
            , url: Feng.ctxPath + '/system/uploadPath'
            , data:{'path':'${path}'}
            , accept: 'file'
            , drag: true
            , before: function (obj) {
                obj.preview(function (index, file, result) {
                    $(tipsId).html(file.name);
                });
            }
            , done: function (res) {
                $(uploadId).val(res.data.fileId);
                Feng.success(res.message);
            }
            , error: function () {
                Feng.error("上传失败！");
            }
        });
    })

</script>